package com.gzxw.mogublog.xo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gzxw.mogublog.commons.entity.WebConfig;
import com.gzxw.mogublog.xo.mapper.WebConfigMapper;
import com.gzxw.mogublog.xo.service.WebConfigService;
import org.springframework.stereotype.Service;

@Service
public class WebConfigServiceImpl extends ServiceImpl<WebConfigMapper, WebConfig> implements WebConfigService {

    @Override
    public WebConfig getWebConfigByShowList() {

        QueryWrapper<WebConfig> queryWrapper = new QueryWrapper<>();
        queryWrapper.orderByDesc("create_time");
        WebConfig webConfig = this.getOne(queryWrapper);
        if (webConfig == null) {
            throw new RuntimeException("系统配置不存在");
        }
        return webConfig;
    }
}
